unit MLPArepRunSamples;

interface

uses Windows, SysUtils, Messages, Classes, Graphics, Controls,
  StdCtrls, ExtCtrls, Forms, Quickrpt, QRCtrls , StBarC, jpeg;

type
  TrepRunSamples = class(TQuickRep)
    TitleBand1: TQRBand;
    DetailBand1: TQRBand;
    QRDBText1: TQRDBText;
    qrdbtSampleID: TQRDBText;
    QRDBText3: TQRDBText;
    ColumnHeaderBand1: TQRBand;
    QRLabel1: TQRLabel;
    QRLabel2: TQRLabel;
    QRLabel3: TQRLabel;
    QRMemo1: TQRMemo;
    QRLabel4: TQRLabel;
    QRShape1: TQRShape;
    QRLabel5: TQRLabel;
    QRDBText4: TQRDBText;
    QRLabel6: TQRLabel;
    QRLabel7: TQRLabel;
    QRDBText5: TQRDBText;
    qriBarcode: TQRImage;
    QRLabel8: TQRLabel;
    qrdbtRunName: TQRDBText;
    PageFooterBand1: TQRBand;
    qriRunBarcode: TQRImage;
    QRSysData1: TQRSysData;
    QRDBText6: TQRDBText;
    QRLabel9: TQRLabel;
    procedure DetailBand1BeforePrint(Sender: TQRCustomBand;
      var PrintBand: Boolean);
    procedure TitleBand1BeforePrint(Sender: TQRCustomBand;
      var PrintBand: Boolean);
  private
    BarcodeRect : TRect;
  public

  end;

var
  repRunSamples: TrepRunSamples;
  Barcode: TSTbarCode;

implementation

uses MLPAdm;

{$R *.DFM}

procedure TrepRunSamples.DetailBand1BeforePrint(Sender: TQRCustomBand;
  var PrintBand: Boolean);
begin
  BarcodeRect:=Rect(0,0,qriBarcode.Picture.Bitmap.Width,qriBarcode.Picture.Bitmap.Height);
  Barcode.Code:=qrdbtSampleID.DataSet.FieldByName(qrdbtSampleID.DataField).AsString;
  BarCode.PaintToCanvas(qriBarcode.Canvas,BarCodeRect);
end;

procedure TrepRunSamples.TitleBand1BeforePrint(Sender: TQRCustomBand;
  var PrintBand: Boolean);
begin
  BarcodeRect:=Rect(0,0,qriBarcode.Picture.Bitmap.Width,qriBarcode.Picture.Bitmap.Height);
  Barcode.Code:=qrdbtRunName.DataSet.FieldByName(qrdbtRunName.DataField).AsString;
  BarCode.PaintToCanvas(qriRunBarcode.Canvas,BarCodeRect);
end;

initialization
  BarCode:=TStBarcode.Create(nil);
  BarCode.BarCodeType:=bcCode128;
  BarCode.Code128Subset:=csCodeB;
  Barcode.ShowCode:=false;
  Barcode.BarWidth:=30;

finalization
  FreeAndNil(BarCode);

end.
